package com.lysj.admin.master.bussiness.company.invoice.controller;

import com.lysj.admin.master.bussiness.company.invoice.domain.InvoiceInfo;
import com.lysj.admin.master.bussiness.company.invoice.mapper.InvoiceInfoMapper;
import com.lysj.admin.master.bussiness.company.invoice.service.InvoiceInfoService;
import com.lysj.admin.master.common.annotation.Update;
import com.lysj.admin.master.common.spring.mpbase.MyController;
import com.lysj.admin.master.common.spring.mpbase.MyService;
import com.lysj.admin.master.common.spring.pagination.PageRequestDTO;
import com.lysj.admin.master.common.web.Resp;
import com.lysj.admin.master.common.web.RespUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Created by drj on 2020-01-08 14:56
 * @description
 */
@Slf4j
@RestController
@RequestMapping("/company/invoice_info")
public class InvoiceInfoController extends MyController<InvoiceInfoMapper, InvoiceInfo, PageRequestDTO> {

    @Resource
    private InvoiceInfoService invoiceInfoService;

    @Override
    public MyService<InvoiceInfoMapper, InvoiceInfo> getService() {
        return invoiceInfoService;
    }

    @GetMapping("/find_by_company_id")
    public Resp findByCompanyId(String companyId) {
        return RespUtil.success(invoiceInfoService.findByCompanyId(companyId));
    }


    @Override
    @Update
    public Resp update(InvoiceInfo entity) {
        return super.update(entity);
    }

}
